home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_35106.txt < prev    next >
Text File  |  1991-02-27  |  1KB  |  40 lines

  1. -- card: 35106 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 6
  9. ----- text -----
  10. 8.4  Memory Management
  11.  
  12. -- part contents for background part 7
  13. ----- text -----
  14. 197
  15.  
  16. -- part contents for background part 4
  17. ----- text -----
  18. Dynamic MEMORY MANAGEMENT is frequently used in TC and C++ to allocate and deallocate objects.  In TC the new() and delete() functions* are defined in the special-purpose 'oops' library and declared in oops.h.  In C++ 'new' and 'delete' are built-in operators which may be applied to non-object "free-store" variables as well.
  19.  
  20. The standard malloc() and free() functions may be used to dynamically allocate and deallocate non-objects (such as floats, character strings, or user-defined structures) in TC or ANSI C.  (In truth, a third method is commonly used in TC:  non-portable calls to the Macintosh memory-management Toolbox routines via the MacTraps library.)
  21.  
  22. These functions are defined in TC's ANSI library and declared in stdlib.h.  (Formerly they were defined in the 'storage' library and declared in storage.h.)
  23.  
  24.     # include   <stdlib.h>
  25.  
  26. The prototype for malloc() is:
  27.  
  28.     void   *malloc(size_t  num_of_bytes);
  29.  
  30. -- part contents for background part 29
  31. ----- text -----
  32. 37143
  33.  
  34. -- part contents for background part 27
  35. ----- text -----
  36. new() & delete() functions
  37.  
  38. -- part contents for background part 20
  39. ----- text -----
  40. new() & delete() functions - p114